<template>
  <div class="an-dialog">
    <el-dialog title="图片预览" v-model="dialogVisible" width="480px" :before-close="changeVisible">
      <el-image :src="url" fit="cover"></el-image>
    </el-dialog>
  </div>
</template>

<script lang="ts">
import { Options, Vue } from "vue-class-component";
@Options({
  props: {
    isVisible: {
      type: Boolean,
      default: false,
    },
    url: {
      type: String,
      default: "",
    },
  },
  emits: ["update:isVisible"],
})
export default class dialogImgScoped extends Vue {
  [x: string]: any;
  dialogVisible: Boolean = this.isVisible;
  data() {
    return {
      form: {
        url:
          "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      },
    };
  }

  changeVisible() {
    this.dialogVisible = this.dialogVisible ? false : true;
    this.$emit("update:isVisible", this.dialogVisible);
  }
}
</script>

<style lang="scss">
.an-dialog {
  .el-dialog__body {
    padding-top: 0;
  }
}
</style>